package com.gxgeek.order.converter;

import com.gxgeek.order.dataobject.OrderMaster;
import com.gxgeek.order.dto.OrderDTO;
import org.springframework.beans.BeanUtils;

import java.util.List;

import static java.util.stream.Collectors.toList;

/**
 * Created by Administrator on 2017/7/12.
 */
public class OrderMaster2OrderDTO {


    public static OrderDTO convert(OrderMaster orderMaster){
        OrderDTO orderDTO = new OrderDTO();
        BeanUtils.copyProperties(orderMaster,orderDTO);
        return orderDTO;
    }
    public static List<OrderDTO> convert(List<OrderMaster> orderMaster){
        OrderDTO orderDTO = new OrderDTO();
        return orderMaster.stream().map(e->convert(e))
                    .collect(toList());

    }
}
